define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        index: function () {
            //
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'logisticsyt/index',
                    add_url: 'logisticsyt/add',
                    edit_url: '',
                    del_url: 'logisticsyt/del',
                    multi_url: 'logisticsyt/multi',
                    table: '',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                showToggle: true,
                cardView: true, //卡片视图
                searchFormVisible: true,
                searchFormTemplate: 'customformtpl',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'ProductName', title: __('产品名称')},
                        {field: 'ProductType', title: __('产品类型')},
                        {field: 'PackageType', title: __('包裹')},
                        {field: 'ServiceCode', title: __('渠道类型')},
                        {field: 'ChargeWeight', title: __('计费')},
                        {field: 'Traceability', title: __('轨迹')},
                        {field: 'Effectiveness', title: __('预计')},
                        {field: 'FreightFee', title: __('运费')},
                        {field: 'RegisteredFee', title: __('挂号费')},
                        {field: 'OtherFee', title: __('其他费用')},
                        {field: 'TotalFee', title: __('总资产')},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});